/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package infra.protocol;

import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import models.User;

/**
 *
 * @author root
 */
public class ClientConnection 
{
    final String HOST_NAME;
    final String CONNECTION_NAME = "Liveditor";
    
    public ClientConnection(String hostIP,User user) throws NotBoundException, MalformedURLException, RemoteException
    {
        this.HOST_NAME = hostIP;
        
        ConnectionProtocol cp = new ConnectionProtocol();
        Naming.lookup("rmi://"+HOST_NAME+"/"+CONNECTION_NAME);
        
        if(cp.getConnection(user))
            throw new RemoteException();
    }
    
}
